
export default [
    {
      path:'/home',
    //   component右侧数值  放置的是一个箭头函数 当这个home被访问的时候才会执行 
    // 当用户访问home的时候 我才加载home组件不访问不加载当前home组件
      component: () => import('@/pages/Home'),
      //路由元信息
      meta:{show:true}
      
    },
    {
        path:'/login', //登陆
        component: () => import('@/pages/Login'),
        meta:{show:false}     
    },
    {
        path:'/register',  //注册
        component: () => import('@/pages/Register'),
        meta:{show:false}
        
    },
    {
        path:'/search/:keyword?', //商品展示搜索
        component: () => import('@/pages/Search'),
        meta:{show:true},
        name:'search',
        
        props(route){
            return {...route.query}
        },
        

        
    },
    {
        path:'/search1/:keyword?', //商品展示搜索
        component: () => import('@/pages/Search1'),
        meta:{show:true},
        name:'search1',
        
        props(route){
            return {...route.query}
        },
        

        
    },
    //重定向
    {
        path:'/',
        redirect:'/home',
    },
    {
        path:'/detail/:skuId',
        component: () => import('@/pages/Detail'),
        meta:{show:true}
    },
    {
        path:'/addCartSuccess',
        component: () => import('@/pages/AddCartSuccess'),
     
        meta:{show:true},
        name:'addCartSuccess',
    },
    {
        path:'/shopcart',
        component: () => import('@/pages/ShopCart'),
       
        meta:{show:true},
        name:'shopcart'
    },
    {
        path:'/trade',
        component: () => import('@/pages/Trade'),
        meta:{show:true},
        beforeEnter: (to, from, next) => {
            if(from.path=='/shopcart'){
                next()
            }else{
                next(false)
            }
          }
    },
    {
        path:'/pay',
        component: () => import('@/pages/Pay'),
        meta:{show:true},
        beforeEnter: (to, from, next) => {
            if(from.path=='/trade'){
                next()
            }else{
                next(false)
            }
          }
    },
    {
        path:'/paysuccess',
        component: () => import('@/pages/PaySuccess'),
        // component:PaySuccess,
        meta:{show:true}
    },
    {
        path:'/center',
        component: () => import('@/pages/Center'),
        meta:{show:true},
        children:[
            {
                path:'myorder',
                component: () => import('@/pages/Center/myOrder'),
            },
            {
                path:'grouporder',
                component: () => import('@/pages/Center/groupOrder'),
            },
            {
                path:'/center',
                redirect:'/center/myorder'
            }
        ]
    }
]